package com.leetcode.题库.score1;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @BelongsProject: LeetCode
 * @BelongsPackage: com.leetcode.题库.score1
 * @Author: lei
 * @CreateTime: 2024-03-25  21:13
 * @Description: TODO
 * @Version: 1.0
 */
public class 偏移量实现加密 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int number = Integer.parseInt(scanner.nextLine());
        for (int i = 0; i < number; i++) {
            String s = scanner.nextLine();
            char[] chars = s.toCharArray();
            for (int j = 0; j < chars.length; j++) {
                int offset = getNumber(j);
                int a = chars[j] + offset;
                if (a < 97 || a > 122) {
                    a = (a - 122) + 97;
                }
                chars[j] = (char) a;
            }
            System.out.println(Arrays.toString(chars));
        }
    }

    private static int getNumber(int j) {
        switch (j) {
            case 0:
                return 1;
            case 1:
                return 2;
            case 2:
                return 4;
            default:
                return getNumber(j - 1) + getNumber(j - 2) + getNumber(j - 3);
        }
    }
}
